FROM node:18-alpine as build-stage

WORKDIR /app

COPY . .

RUN yarn install
RUN yarn build:webpack

#生产stage
FROM node:18-alpine as production-stage
COPY --from=build-stage /app/dist /app
COPY --from=build-stage /app/package.json /app
COPY --from=build-stage /app/.sequelizerc /app/.sequelizerc
COPY --from=build-stage /app/migrate /app/migrate
COPY --from=build-stage /app/yarn.lock /app/yarn.lock

WORKDIR /app

RUN yarn install --production
ENV TZ Asia/Shanghai
ENV NODE_ENV production

EXPOSE 3000

CMD ["node", "main.js"]
